package student

import (
	"XSSS_v2/config"
	"XSSS_v2/handler"
	"XSSS_v2/model"
	"XSSS_v2/pkg/errno"
	"github.com/gin-gonic/gin"
)

// ListAllStu
// @Tags admin
// @Summary 返回所有学生
// @Produce json
// @Success 200 {object} handler.Response "{"code":0,"message":"OK","data":response}"
// @Router /v1/admin [GET]
func ListAllStu(c *gin.Context) {
	config.Log.Infof("ListAllStu request called")
	//不用参数

	//返回的结果是一个切片数据
	responseList := &ListResponse{}
	var err error
	responseList.TotalCount, responseList.StudentList, err = model.GetAllStu()
	if err != nil {
		handler.SendResponse(c, errno.ErrDatabase, nil)
		return
	}

	handler.SendResponse(c, nil, responseList)

}
